package values

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestIsASCII(t *testing.T) {
	tests := []struct {
		input    string
		expected bool
	}{
		{"", true},
		{"Hello, World!", true},
		{"こんにちは", false},
		{"Hello, こんにちは", false},
		{"1234567890", true},
		{"!@#$%^&*()", true},
		{"😊", false},
		{"ASCII😊", false},
	}

	for _, test := range tests {
		result := IsASCII(test.input)
		if result != test.expected {
			t.Errorf("IsASCII(%q) = %v; want %v", test.input, result, test.expected)
		}
	}
}
func TestIsLetter(t *testing.T) {
	as := assert.New(t)
	as.Equal(IsLetterWith("aNdfsfsgsrCVdf", 0, 0, 0), true)
	as.Equal(IsLetterWith("dfafaf", 1, 0, 0), true)
	as.Equal(IsLetterWith("dfa", 1, 0, 3), true)
	as.Equal(IsLetterWith("AVX", 2, 0, 3), true)
	as.Equal(IsLetterWith("aNdfsfsgsrCVdf", 1, 0, 0), false)
	as.Equal(IsLetterWith("dfFafaf", 2, 0, 0), false)
	as.Equal(IsLetterWith("aNPd", 0, 0, 3), false)
	as.Equal(IsLetterWith("dffa", 0, 0, 3), false)
	as.Equal(IsLetterWith("a0NPd", 0, 0, 0), false)
	as.Equal(IsLetterWith("df-=fa", 0, 0, 0), false)
	as.Equal(IsLetterWith("56445641", 0, 1, 0), true)
	as.Equal(IsLetterWith("56445641", 0, 2, 0), false)
	as.Equal(IsLetterWith("5FSFSGFSG6445641", 0, 1, 0), true)
	as.Equal(IsLetterWith("FSFSGFSG6445641", 0, 2, 0), true)
	as.Equal(IsLetterWith("564FSGAGA45641", 0, 2, 0), false)
	as.Equal(IsLetterWith("564-415-641", 0, 1, 0, "-"), true)
	as.Equal(IsLetterWith("afa_F05_641", 0, 2, 11, "-_"), true)
}
func BenchmarkIsLetter(b *testing.B) {
	as := assert.New(b)
	for n := 0; n < b.N; n++ {
		as.Equal(IsLetterWith("aNdfsfsgsrCVdf", 0, 0, 0), true)
		as.Equal(IsLetterWith("dfafaf", 1, 0, 0), true)
		as.Equal(IsLetterWith("dfa", 1, 0, 3), true)
		as.Equal(IsLetterWith("AVX", 2, 0, 3), true)
		as.Equal(IsLetterWith("aNdfsfsgsrCVdf", 1, 0, 0), false)
		as.Equal(IsLetterWith("dfFafaf", 2, 0, 0), false)
		as.Equal(IsLetterWith("aNPd", 0, 0, 3), false)
		as.Equal(IsLetterWith("dffa", 0, 0, 3), false)
		as.Equal(IsLetterWith("a0NPd", 0, 0, 0), false)
		as.Equal(IsLetterWith("df-=fa", 0, 0, 0), false)
		as.Equal(IsLetterWith("56445641", 0, 1, 0), true)
		as.Equal(IsLetterWith("56445641", 0, 2, 0), false)
		as.Equal(IsLetterWith("5FSFSGFSG6445641", 0, 1, 0), true)
		as.Equal(IsLetterWith("FSFSGFSG6445641", 0, 2, 0), true)
		as.Equal(IsLetterWith("564FSGAGA45641", 0, 2, 0), false)
		as.Equal(IsLetterWith("564-415-641", 0, 1, 0, "-"), true)
		as.Equal(IsLetterWith("afa_F05_641", 0, 2, 11, "-_"), true)
	}
}
